﻿using System;
using System.Collections;
using System.Data;

namespace GandAInvitaciones.BusinessEntity
{
    [Serializable]
    public class Parameter
    {
        private string nombreParametro;

        public string NombreParametro
        {
            get { return nombreParametro; }
            set { nombreParametro = value; }
        }

        private object valor;

        public object Valor
        {
            get { return valor; }
            set { valor = value; }
        }

        private vEnumType type;

        public vEnumType Type
        {
            get { return type; }
            set { type = value; }
        }

        public Parameter()
        {
            nombreParametro = null;
            valor = null;
            type = vEnumType.Int;
        }

        public Parameter(string _nombreParametro, object _valor, vEnumType _type)
        {
            nombreParametro = _nombreParametro;
            valor = _valor;
            type = _type;
        }

        public enum vEnumType
        {
            Binary = SqlDbType.Binary,
            Bit = SqlDbType.Bit,
            BigInt = SqlDbType.BigInt,
            Char = SqlDbType.Char,
            Date = SqlDbType.Date,
            DateTime = SqlDbType.DateTime,
            Decimal = SqlDbType.Decimal,
            DateTime2 = SqlDbType.DateTime2,
            DateTimeOffset = SqlDbType.DateTimeOffset,
            vFloat = SqlDbType.Float,
            Image = SqlDbType.Image,
            Int = SqlDbType.Int,
            Money = SqlDbType.Money,
            NChar = SqlDbType.NChar,
            NText = SqlDbType.NText,
            NVarChar = SqlDbType.NVarChar,
            Real = SqlDbType.Real,
            SmallDateTime = SqlDbType.SmallDateTime,
            SmallInt = SqlDbType.SmallInt,
            SmallMoney = SqlDbType.SmallMoney,
            Structured = SqlDbType.Structured,
            Text = SqlDbType.Text,
            Time = SqlDbType.Time,
            Timestamp = SqlDbType.Timestamp,
            TinyInt = SqlDbType.TinyInt,
            Udt = SqlDbType.Udt,
            UniqueIdentifier = SqlDbType.UniqueIdentifier,
            VarBinary = SqlDbType.VarBinary,
            VarChar = SqlDbType.VarChar,
            Variant = SqlDbType.Variant,
            Xml = SqlDbType.Xml
        }
    }

    [Serializable]
    public class ParameterCollection : CollectionBase
    {
        #region Propiedades
        public Parameter this[int index]
        {
            get
            {
                return ((Parameter)List[index]);
            }
            set
            {
                List[index] = value;
            }
        }

        #endregion

        public int Add(Parameter value)
        {
            return List.Add(value);
        }
        public int IndexOf(Parameter value)
        {
            return List.IndexOf(value);
        }
        public void Insert(int index, Parameter value)
        {
            List.Insert(index, value);
        }
        public void Remove(Parameter value)
        {
            List.Remove(value);
        }
    }
}
